package kr.totalcall.formatters
{
	import spark.formatters.NumberFormatter;

	/**
	 * 작업 기록
	 * 2012. 7. 3. / 이규광 / 최초 작성.
	 */
	/**
	 * 요금 포맷 ex) 1,000
	 * @productversion Flex 4.5
	 * @langversion ActionScript 3.0
	 * @playerversion Flash 10.2
	 * @author 이규광.
	 */
	public class FareFormatter
	{
		
		
		private static var nf:NumberFormatter ;
		
		public static function get formatter():NumberFormatter{
			if(nf == null ){
				nf = new NumberFormatter();
				nf.fractionalDigits = 0;
				nf.useGrouping = true;
			}
			return nf;
		}
		
		
		/**
		 * 요금 포맷
		 */
		public static function format(value:Object):String{
			if(value is String){
				return formatter.format(Number(value));
			}else if(value is Number){
				return formatter.format(value);
			}
			return "NaN";
		}
		
		
		/**
		 * 생성자
		 */
		public function FareFormatter()
		{
		}
	}
}